dzn -> json

50 views
Skip to first unread message

Laurent Perron

unread,
Feb 27, 2025, 5:11:26 PMFeb 27
to mini...@googlegroups.com
Hi, 

Is there a tool that performs the translation ?

Thanks
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00

Michal Dobrogost

unread,
Mar 24, 2025, 4:33:44 AMMar 24
to MiniZinc
Hi Laurent,

What is the JSON output format you are interested in? I worked last year on a new JSON CSP format (and C parser) and would be interested if any of the established csp formats (minizinc, xcsp3) have existing JSON schemas.

https://github.com/michal-dobrogost/csp-json

Best,

Mike

Laurent Perron

unread,
Mar 24, 2025, 4:40:12 AMMar 24
to mini...@googlegroups.com
We are using minizinc examples for benchmarking, and it would be much easier if the dzn files were actually json files as we have more tools to deal with json, in particular in python as we are using the minizinc python API.

I know minizinc supports json data files natively, but most of the data files in the mzn-challenge github repo are still in the dzn format.
So it would be nice to convert them to json in one shot.
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


--
You received this message because you are subscribed to the Google Groups "MiniZinc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minizinc+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/minizinc/6db5e23c-1f86-47d8-b334-31882633c92an%40googlegroups.com.

Jip Dekker

unread,
Mar 24, 2025, 4:40:34 AMMar 24
to MiniZinc
Hi Mike,

Laurent was talking about converting the DZN data format into JSON files (which are also accepted by MiniZinc). This appears to be quite different from the goals of your project.

It seems I had replied with a private message accidentally, but I had replied that there is no general tool that performs the transformation from DZN to JSON. However, it is easy to do for individual cases using the following steps:
  1. Create a new MZN file that contains only the input parameter definitions of the original models.
  2. Add “::output” to each definition.
  3. Run MiniZinc with the “--output-mode json” and “--soln-sep ''” flags on each data file.
  4. The resulting output should be the valid JSON for the model.
Cheers,
Jip
Reply all
Reply to author
Forward
0 new messages